muxer: add helper to get group by name
authorChristian Hergert <chergert@redhat.com>
Thu, 3 Dec 2020 03:41:16 +0000 (19:41 -0800)
committerChristian Hergert <chergert@redhat.com>
Thu, 3 Dec 2020 03:44:02 +0000 (19:44 -0800)
This is useful when you need to read a group back out of the muxer.

gtk/gtkactionmuxer.c
gtk/gtkactionmuxerprivate.h

index ed9ee26b85889e4ae781514910a85c54f0942c56..fad926ceaf71857738a67e8f24f83429fb2455b0 100644 (file)
@@ -315,6 +315,19 @@ gtk_action_muxer_find (GtkActionMuxer  *muxer,
   return NULL;
 }
 
+GActionGroup *
+gtk_action_muxer_get_group (GtkActionMuxer *muxer,
+                            const char     *group_name)
+{
+  Group *group;
+
+  group = g_hash_table_lookup (muxer->groups, group_name);
+  if (group)
+    return group->group;
+
+  return NULL;
+}
+
 static inline Action *
 find_observers (GtkActionMuxer *muxer,
                 const char     *action_name)
index 63a8f51c6cfdb7801477f9648141a21f33a51c9d..db69cabc9d6c418c3ac9995622592d7c3d041c72 100644 (file)
@@ -60,6 +60,8 @@ void                    gtk_action_muxer_remove                         (GtkActi
 GActionGroup *          gtk_action_muxer_find                           (GtkActionMuxer *muxer,
                                                                          const char     *action_name,
                                                                          const char    **unprefixed_name);
+GActionGroup *          gtk_action_muxer_get_group                      (GtkActionMuxer *muxer,
+                                                                         const char     *group_name);
 GtkActionMuxer *        gtk_action_muxer_get_parent                     (GtkActionMuxer *muxer);
 
 void                    gtk_action_muxer_set_parent                     (GtkActionMuxer *muxer,